package org.demo.web.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * @author Vincent Dijkstra
 *
 */
@Component ("securityInterceptor")
public class SecurityInterceptor extends HandlerInterceptorAdapter {

    /* ---- Constants ---- */


    /* ---- Instance Variables ---- */

    /* ---- Constructors ---- */
	public SecurityInterceptor() {
		super();
		System.out.println("SecurityInterceptor - Initiated");

	}

    /* ---- Business Methods ---- */

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    	System.out.println("Before Accessing Service");
        return super.preHandle(request, response, handler);
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
    	System.out.println("After Accessing Service");
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    	System.out.println("After Completion");
    }

    /* ---- Getters and Setters ---- */




}
